<html>
  <head>
    <title tal:content="title">
    </title>
	<link rel="stylesheet" href="../css/stylesheet.css" type="text/css" />
	<script src="http://code.jquery.com/jquery-latest.js"></script>
  </head>
<?php
require_once '../conf/DbConnector.php';

$db=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
		or die('<p><font color=red>Fehler bei der Datenbankverbindung: '.
		mysqli_connect_errno().': '.mysqli_connect_error().'</p>');	

$sql_name="SELECT Series.Ser_Name 
    FROM Book, Book_has_Lang, Series
    WHERE Book.Book_ID = Book_has_Lang.Book_Book_ID 
    AND Book.Series_Ser_ID = " . $_GET['id'] . "
    AND Series.Ser_ID = " . $_GET['id'] . "
    AND Book_has_Lang.Lang_Lang_ID = 1 
    ORDER BY Book.Book_Vol";
  
$result_name = mysqli_query($db, $sql_name);
$zeile_name=mysqli_fetch_array($result_name);

?>
  <body>
    <div id="kopf">
	<div id="kopf1">
		hallo Mitte
		<div id="login">
			rechts login
		</div>
		<div id="logo">
			Logo
		</div>
	</div>
	<div id="pfad">
		<p><a href="../">Index</a> > <a href="./">Series</a> > <?php echo $zeile_name['Ser_Name']; ?></p>
	</div>
</div>
    <div id="series">
<?php

//$sql="SELECT Book.Series_Ser_ID, Book.Book_ID, Book.Book_Vol, Book.Book_Name, Series.Ser_Name 
//    FROM Book, Book_has_Lang, Series
//    WHERE Book.Book_ID = Book_has_Lang.Book_Book_ID 
//    AND Book.Series_Ser_ID = " . $_GET['id'] . "
//    AND Series.Ser_ID = " . $_GET['id'] . "
//    AND Book_has_Lang.Lang_Lang_ID = 1 
//    ORDER BY Book.Book_Vol";

$sql="SELECT Book.Series_Ser_ID, Book.Book_ID, Book.Book_Vol, Book.Book_Name, Series.Ser_Name 
    FROM Book, Book_has_Lang, Series, LNDL
    WHERE Book.Book_ID = LNDL.Book_Book_ID 
    AND Book.Series_Ser_ID = " . $_GET['id'] . "
    AND Series.Ser_ID = " . $_GET['id'] . "
    GROUP BY Book.Book_ID
    ORDER BY Book.Book_Vol";

$result = mysqli_query($db, $sql);

    
while ($zeile=mysqli_fetch_array($result)){


?>
        
        <div id="content">
            <div class="ENAME" onClick="self.location.href='Book.php?id=<?php echo $zeile['Book_ID']; ?>'"><?php if (isset($zeile['Book_Vol'])) { ?><div class="SNAME">Volume <?php echo $zeile['Book_Vol']; ?></div><?php } ?><?php if (isset($zeile['Book_Name'])) { ?><div class="ANAME"><?php echo $zeile['Book_Name']; ?></div><?php } ?><?php if (empty ($zeile['Book_Name']) & empty( $zeile['Book_Vol'])) { ?><div align="center"><?php echo $zeile['Ser_Name']; ?></div><?php } ?></div>
        </div>
        
<?php

}

mysqli_close($db);

?>
  </div>
  </body>
</html>